<div class="layui-card-header layui-card">
    <span class="layui-breadcrumb" lay-filter="breadcrumb">
        <a lay-href="">首页</a>
        <a>所有商户</a>
        <a><cite>账户详情</cite></a>
    </span>
</div>
<style>
    .layui-form-label {
        width:15% !important;
        margin-left:1%;
    }
    .layui-input-inline {
        width: 33% !important;
    }
</style>
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-tab layui-tab-brief">
            <ul class="layui-tab-title">
                <li class="layui-this">账户详情</li>
            </ul>
            <div class="layui-tab-content">
                <form class="layui-form layui-form-pane" id="layuiadmin-app-form-list">
                    <div class="layui-form-item">
                        <label class="layui-form-label">商户ID</label>
                        <div class="layui-input-inline">
                            <input type="text" id="mchId" name="mchId" disabled="disabled" class="layui-input">
                        </div>
                        <label class="layui-form-label">商户名称</label>
                        <div class="layui-input-inline">
                            <input type="text" id="name" name= "name" disabled="disabled" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">商户类型</label>
                        <div class="layui-input-inline">
                            <input type="text" id="type" name="type" disabled="disabled" class="layui-input">
                        </div>
                        <label class="layui-form-label">账户余额(元)</label>
                        <div class="layui-input-inline">
                            <input type="text" id="balance" name="balance" disabled="disabled" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">不可用余额(元)</label>
                        <div class="layui-input-inline">
                            <input type="text" id="unBalance"  name="unBalance" disabled="disabled" class="layui-input">
                        </div>
                        <label class="layui-form-label">账户状态</label>
                        <div class="layui-input-inline">
                            <input type="text" id="status" name="status" disabled="disabled" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">保证金(元)</label>
                        <div class="layui-input-inline">
                            <input type="text" id="securityMoney" name="securityMoney" disabled="disabled" class="layui-input">
                        </div>
                        <label class="layui-form-label">总收益(元)</label>
                        <div class="layui-input-inline">
                            <input type="text" id="totalIncome" name="totalIncome" disabled="disabled" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">总支出(元)</label>
                        <div class="layui-input-inline">
                            <input type="text" id="totalExpend" name="totalExpend" disabled="disabled" class="layui-input">
                        </div>
                        <label class="layui-form-label">今日收益(元)</label>
                        <div class="layui-input-inline">
                            <input type="text" id="todayIncome" name="todayIncome" disabled="disabled" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">今日支出(元)</label>
                        <div class="layui-input-inline">
                            <input type="text" id="todayExpend" name="todayExpend" disabled="disabled" class="layui-input">
                        </div>
                        <label class="layui-form-label">可结算金额(元)</label>
                        <div class="layui-input-inline">
                            <input type="text" id="settAmount" name="settAmount" disabled="disabled" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">创建时间</label>
                        <div class="layui-input-inline">
                            <input type="text" id="createTime" name="createTime" disabled="disabled" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-input-block" style="margin-left: 12px">
                            <a class="layui-btn backBtn" onclick="back()">返回</a>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
    <script>
        layui.use(['table','util','admin', 'form'], function(){
            var table = layui.table
                ,$ = layui.$
                ,form = layui.form
                ,admin = layui.admin
                ,element = layui.element;

            element.render('breadcrumb', 'breadcrumb'); // 渲染导航信息

            var mchId = layui.router().search.mchId;
            admin.req({
                type: 'get',
                url: layui.setter.baseUrl + '/account/get',
                data: {
                    mchId : mchId
                },
                error: function(err){
                    layer.alert(JSON.stringify(err.field), {
                        title: '错误提示'
                    })
                },
                success: function(res){
                    if (res.code == 0) {
                        // 2 赋值
                        $('#mchId').val(res.data.mchId);
                        $('#type').val(res.data.kind == 1 ? "平台账户" : "私有账户");
                        $('#balance').val(res.data.balance / 100);
                        $('#unBalance').val(res.data.unBalance / 100);

                        $('#name').val(res.data.name);
                        $('#securityMoney').val(res.data.securityMoney / 100);
                        $('#totalIncome').val(res.data.totalIncome / 100);
                        $('#totalExpend').val(res.data.totalExpend / 100);
                        $('#todayIncome').val(res.data.todayIncome / 100);
                        $('#todayExpend').val(res.data.todayExpend / 100);
                        $('#settAmount').val(res.data.settAmount / 100);

                        if(res.data.state == 1) {
                            $('#status').val("启用");
                        }else {
                            $('#status').val("停止");
                        }
                        if(res.data.createTime != "" && res.data.createTime != null) {
                            $('#createTime').val(layui.util.toDateString(res.data.createTime));
                        }
                    }
                }
            })
        })

        function back(){
            location.href = layui.setter.baseLocal + "merchant/list/index";
        }
    </script>
</form>